<?php
get_header(); 

// To Show Banner and Title
get_template_part( 'inc/title-bar' ); 
?>

		<!--OPENING CONTENT-->
		<div id="content">
		                
		        <?php 
				// Include Breadcrumb Bar
				get_template_part( 'inc/breadcrumb-sharebar' ); 
				?>
		          		
				<div class="agent-info-box">												
					<div class="agent-data clearfix">				
						
						<?php $curauth = $wp_query->get_queried_object(); ?>				
						
						<a href="<?php echo get_author_posts_url( $curauth->ID ); ?>">
							<?php if (function_exists('get_avatar')) { echo get_avatar( $curauth->user_email, '70' ); }?>
						</a>	
																																
						<div class="agent-content-container clearfix">						
								<h3><?php echo $curauth->display_name; ?></h3>						
								<div class="agent-contact">
										<?php
										$mobile = get_the_author_meta( 'mobile',$curauth->ID );
										$office = get_the_author_meta( 'office',$curauth->ID );
										$fax = get_the_author_meta( 'fax',$curauth->ID );
										
										if(!empty($mobile))
										{
											?>
											<span class="mobile"><strong><?php _e('Mobile','locality'); ?></strong>: <?php echo $mobile;?></span>
											<?php
										}
										
										if(!empty($office))
										{
											?>
											<span class="office"><strong><?php _e('Office','locality'); ?></strong>: <?php echo $office;?></span>
											<?php
										}
										
										if(!empty($fax))
										{
											?>
											<span class="fax"><strong><?php _e('Fax','locality'); ?></strong>: <?php echo $fax;?></span>
											<?php
										}					
										?>
								</div>						
								<div class="agent-desc">
									<p><?php echo $curauth->user_description; ?></p>
								</div>						
						</div>				
					</div>			
				</div><!-- Agent Info Box -->
				
		         <div class="listing">
						
						<?php 
												
							global $wp_query;										
							$old_max_num_page = intval($wp_query->max_num_pages);										
							$args = array_merge( $wp_query->query, array( 'post_type' => array( 'property') ) );										
							query_posts( $args );											
							$new_found_posts = intval($wp_query->found_posts);										
							if($old_max_num_page > 0)
							{									
								$posts_per_page  = intval(ceil($new_found_posts / $old_max_num_page));	
							}
							else
							{
								$posts_per_page  = $new_found_posts ;	
							}									
							$args = array_merge( $wp_query->query, array( 'posts_per_page' => $posts_per_page ) );										
							query_posts( $args );	
							
							$i = 0;						
							if ( have_posts() ) 
							{
								while ( have_posts() ) :
								 
									the_post(); 
									$i++;
									
										?>			               
										<div class="property-item <?php if ($i % 2 == 0) { echo "even"; } ?>" >
											<?php get_template_part( 'inc/display-property' ); ?>                        
						                </div>	
										<?php 
									
									if ( ($i % 2) == 0 ) 
									{
										echo "<hr />";
									}
						 
						 		endwhile;
							}
					?>
					                
		        </div>
		     
		        <!-- PAGINATION -->
		        <?php theme_pagination($wp_query->max_num_pages); ?>
		        
		</div><!-- CLOSING CONTENT--> 
		
		<!-- SIDEBAR -->
		<?php get_sidebar('blog'); ?>

<!-- FOOTER -->
<?php get_footer(); ?>